home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
emulate
/
zxupload.arc
/
Z80.S
< prev
next >
Wrap
Text File
|
1992-05-31
|
2KB
|
63 lines
;midixfer (Spectrum version)
;by Stephen K Mulrine
;load any normal Spectrum program/code (less than 41456 bytes)
;and shove the whole lot through the RAM Music Machine's MIDI OUT
;fun for all the family!
org 23296 ;assemble into printer buffer
xor a
scf
ld ix,24064
ld de,17
call 1366 ;load a 17-byte header at 24064
ld hl,(24075) ;get length of file
ex de,hl
ld ix,24081
ld a,255
scf
call 1366 ;load rest of file after header in memory
ld a,1
out (95),a ;replace interrupts with ACIA IRQ signal
ld bc,127
ld a,21
out (c),a ;keep Spectrum's hands off ACIA
ld de,17
ld hl,(24075)
add hl,de ;total number of bytes to transfer
ex de,hl
ld bc,383
ld a,e
out (c),a ;send LSB of length down cable
ld bc,639
loop1 in a,(c) ;read status
bit 1,a
jr z,loop1 ;wait until sent
ld bc,383
ld a,d
out (c),a ;send MSB of length down cable
ld bc,639
loop2 in a,(c) ;read status
bit 1,a
jr z,loop2 ;wait until sent
inc de ;can't remember why I did this
ld hl,24064
loop3 ld bc,383 ;dig those labels
ld a,(hl) ;get byte to send
out (c),a ;send it
and 7
out (254),a ;tamper with border for laffs
ld bc,639
loop4 in a,(c) ;read status (again)
bit 1,a
jr z,loop4 ;wait until sent (again)
inc hl
dec de ;I assembled this by hand, you know
ld a,d
or e ;all bytes sent?
jr nz,loop3 ;this is how the pros do it, honest
ld bc,127
ld a,131
out (c),a ;give ACIA back to Spectrum
xor a
out (95),a ;restore interrupts
ret ;auf wiedersehen